package diertian;

import java.util.Scanner;

public class lianxi10 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int nowy,nowm,nowd,birthy,birthm,birthd;
        System.out.println("请输入你所在的年份");
        nowy=scanner.nextInt();
        System.out.println("请输入你所在的月份");
        nowm=scanner.nextInt();
        System.out.println("请输入你所在的日子");
        nowd=scanner.nextInt();
        System.out.println("亲输入你的出生年份");
        birthy=scanner.nextInt();
        System.out.println("输入你的出生月份");
        birthm=scanner.nextInt();
        System.out.println("输入你的出生日期");
        birthd=scanner.nextInt();
        int age=nowy-birthy;
        if(nowm<birthm){
            age=age-1;
        }
        if(nowm==birthm &&  nowd<birthd){
            age=age-1;
        }
        System.out.println("年龄是：" + age);
    }
}
